/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package testchat;

import java.io.IOException;
import java.net.*;

/**
 *
 * @author ThanhKhanh
 */
public class SendMulticast1 {

    private static int DGRAM_LENGTH = 1024;
    private static int DEST_PORT = 1234;

    public static void main(String arg[]) throws SocketException, IOException, InterruptedException {
        DatagramSocket socket = new DatagramSocket();

        byte[] b = new byte[DGRAM_LENGTH];
        DatagramPacket dgram;

        byte[] b2 = new byte[4];
            b2[0]=(byte) 224;
            b2[1]=0;
            b2[2]=0;
            b2[3]=1;
        dgram = new DatagramPacket(b, b.length,
                InetAddress.getByAddress(b2), DEST_PORT);

        System.err.println("Sending " + b.length + " bytes to "
                + dgram.getAddress() + ':' + dgram.getPort());
        while (true) {
            System.err.print(".");
            socket.send(dgram);
            Thread.sleep(1000);
        }

    }
}
